cpuidle: reduce redundant cost in cstate_restore_tsc for nonstop tsc
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 17 Jun 2010 07:50:55 +0000 (08:50 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 17 Jun 2010 07:50:55 +0000 (08:50 +0100)
Signed-off-by: Wei Gang <gang.wei@intel.com>
xen/arch/x86/time.c

index d500490254f2c1f1568fb22c39246d6e038949d1..3a824ec516bf05f9c59c595d8280959b43cd6656 100644 (file)
@@ -664,14 +664,17 @@ static void __init init_platform_timer(void)
 
 void cstate_restore_tsc(void)
 {
-    struct cpu_time *t = &this_cpu(cpu_time);
-    struct time_scale sys_to_tsc = scale_reciprocal(t->tsc_scale);
+    struct cpu_time *t;
+    struct time_scale sys_to_tsc;
     s_time_t stime_delta;
     u64 new_tsc;
 
     if ( boot_cpu_has(X86_FEATURE_NONSTOP_TSC) )
         return;
 
+    t = &this_cpu(cpu_time);
+    sys_to_tsc = scale_reciprocal(t->tsc_scale);
+
     stime_delta = read_platform_stime() - t->stime_master_stamp;
     if ( stime_delta < 0 )
         stime_delta = 0;